/*
 * Copyright (C) 2015 Actor LLC. <https://actor.im>
 */

$emoji-dropdown-width: 328px;
$stem-size: $default-stem-size;

.emoji-outer {
  line-height: $message-line-height;

  display: inline-block;

  width: $message-line-height;
  height: $message-line-height;

  vertical-align: middle;
}

.emoji-inner {
  display: block;

  width: 100%;
  height: 100%;

  vertical-align: inherit;
  text-indent: -9999px;
}

.emoji-sizer {
  box-sizing: border-box;
  margin: 0;
  padding: 1px;

  background-size: 100%;
}

.emoji-dropdown {
  position: relative;
  z-index: 15;

  color: rgba($greyish-brown, .6);

  &__wrapper {
    position: absolute;
    right: -3px;
    bottom: 6px;

    display: none;

    border-radius: 3px;
    background-color: white;
    box-shadow: 0 1px 3px 1px rgba(0, 0, 0, .1);
    @mixin stem() {
      position: absolute;
      right: $stem-size;
      bottom: - $stem-size / 2;

      width: $stem-size;
      height: $stem-size;

      content: '';
      transform: rotate(45deg);

      background-color: white;
    }

    &:before {
      @include stem();
    }
    &:after {
      z-index: -1;

      box-shadow: 0 1px 3px 1px rgba(0, 0, 0, .1);

      @include stem();
    }
  }
  &__header {
    font-size: 12px;
    line-height: 20px;

    padding: 0;

    border-radius: 3px 3px 0 0;
    background-color: white;
    box-shadow: inset 0 -1px 0 0 #ebebeb;

    @include clearfix();
    &__title {
      display: inline-block;

      margin: 5px 0 5px 6px;
    }
    &__tabs {
      line-height: 1px;

      margin: 0;
      padding: 0;

      list-style: none;
      &__tab {
        line-height: 24px;

        display: inline-block;

        margin: 0;
        padding: 4px;

        cursor: pointer;
        text-align: center;
        & > span {
          pointer-events: none;
        }
        .emoji-outer {
          line-height: 1px;

          width: 22px;
          height: 22px;

          opacity: .4;

          filter: grayscale(1);
        }
        &:hover {
          box-shadow: inset 0 -3px 0 0 #ebebeb;
        }

        &--active {
          box-shadow: inset 0 -3px 0 0 $dark-sky-blue !important;
          .emoji-outer {
            opacity: .9 !important;

            filter: none !important;
          }
        }
      }
    }
  }
  &__body {
    position: relative;
    z-index: 16;

    overflow-x: hidden;
    overflow-y: auto;

    box-sizing: border-box;
    width: $emoji-dropdown-width;
    height: 200px;

    @include clearfix();
    div {
      padding: 4px;

      border-bottom: 1px solid #ebebeb;

      @include clearfix();
      &:last-child {
        border-bottom: 0;
      }
      p {
        font-size: 12px;

        display: block;

        margin: 0;
        padding: 6px 2px 10px;
      }
      a {
        line-height: 1px;

        display: block;
        float: left;

        padding: 2px;

        cursor: pointer;

        border-radius: 2px;
        .emoji-outer {
          transform-origin: 50% 50%;
          pointer-events: none;
        }
        &:hover {
          .emoji-outer {
            transform: scale(1.4);
          }
        }
      }
    }

    .emoji-outer {
      width: 28px;
      height: 28px;
    }
  }
  &--opened {
    .emoji-dropdown__wrapper {
      display: block;
    }
  }

  .emoji-opener {
    position: absolute;
    top: 6px;
    right: 6px;

    cursor: pointer;
    transition: 150ms;
    transform: scale(.9);

    opacity: .8;
    color: $greyish;

    @include no-select();
    &--active,
    &:hover {
      transform: scale(1);

      opacity: 1;
      color: $dark-sky-blue;
    }

    &--with-dot {
      &:after {
        position: absolute;
        top: 0;
        right: 1px;

        width: 8px;
        height: 8px;

        content: '';

        border-radius: 50%;
        background-color: $coral;
      }
    }
  }
}
